<template>
  <div class="u-p-20">
    <el-card shadow="never">
      <div slot="header">
        <span>
          <b class="u-f-16">商家认证列表</b>
        </span>
        <!-- <router-link :to="{name:'distributorEdit'}" v-if="hasPerm('distributorEdit')">
                    <el-button type="danger" size="small" icon="el-icon-plus" class="u-right u-5mt" round>添加渠道商</el-button>
                </router-link> -->
      </div>

      <el-form
        :inline="true"
        :model="queryForm"
        size="small"
        class="u-text-center"
      >
        <el-form-item label="状态">
          <el-select v-model="queryForm.status" clearable>
            <el-option label="全部" value></el-option>
            <el-option label="审核中" value="0"></el-option>
            <el-option label="审核通过" value="1"></el-option>
            <el-option label="审核失败" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="关键词">
          <el-input
            v-model="queryForm.keyword"
            placeholder="输入商家名称或电话号码"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="getPageData(true)"
            >查询</el-button
          >
        </el-form-item>
      </el-form>

      <el-table :data="tableData" class="u-mt-10" v-viewer>
        <el-table-column label="id" prop="id" width="100"></el-table-column>
        <el-table-column label="门脸图" width="90">
          <template slot-scope="scope">
            <el-image
              style="max-height:90px;max-width: 90px;"
              :src="scope.row.storefront"
              :data-src="scope.row.storefront"
              fit="cover"
              lazy
            ></el-image>
          </template>
        </el-table-column>
        <el-table-column label="名称" prop="name"></el-table-column>
        <el-table-column label="联系人" prop="contact_name"></el-table-column>
        <el-table-column
          label="联系电话"
          prop="contact_phone"
        ></el-table-column>
        <el-table-column label="地址" prop="address"></el-table-column>
        <el-table-column label="审核备注" prop="check_info"></el-table-column>
        <el-table-column label="状态">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.check_status == 0">审核中</el-tag>
            <el-tag type="success" v-if="scope.row.check_status == 1">审核通过</el-tag>
            <el-tag type="danger" v-if="scope.row.check_status == 2">审核失败</el-tag>
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="120">
          <template slot-scope="scope">
            <el-button
              @click.native="handleRoute(scope.row.id, 'businessEdit')"
              v-if="hasPerm('businessEdit')"
              type="text"
              size="small"
              >编辑审核</el-button
            >
            <el-button
              @click.native="handleDelete(scope.row.id)"
              v-if="hasPerm('businessDelBtn')"
              type="text"
              size="small"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <div class="u-mt-20 u-text-center">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40, 50]"
          :page-size="limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import commonPage from "@/mixins/common-page";

export default {
  mixins: [commonPage],
  props: {},
  data() {
    return {
      apiName: "business",
      queryForm: {
        status: "",
        keyword: "",
      },
    };
  },
  methods: {},
};
</script>
